package com.topwater.topwater.utils;

import net.sourceforge.pinyin4j.PinyinHelper;

/**
 * author:凯子
 * date:2023-08-24 11:06
 * 描述:
 **/
public  class Rconfig {

        public static String generateRandom(int digitNumber) {
            if (digitNumber == 0) {
                return "";
            }
            String randomStr = String.valueOf((long) ((Math.random() * 9.0 + 1) * (Math.pow(10, digitNumber - 1))));
            return randomStr;
        }
    public static String getPinYinHeadChar(String str)
    {
        String convert = "";
        for (int j = 0; j < str.length(); j++)
        {
            char word = str.charAt(j);
            String[] pinyinArray = PinyinHelper.toHanyuPinyinStringArray(word);
            if (pinyinArray != null)
            {
                convert += pinyinArray[0].charAt(0);
            } else
            {
                convert += word;
            }
        }
        return convert;
    }

}

